import axios from 'axios';
import Vuex from '../store/index'
let baseUrl = 'http://api.cat-shop.penkuoer.com';
export const GET = (url, params, headers) => {
	return axios({
		url: `${baseUrl}${url}`,
		params: params,
		headers: {
			authorization: `Bearer `+localStorage.getItem('token')
		}
	}).then(res => {
		return res
	})
}
export const POST = (url, params, headers) => {
	return axios({
		url: `${baseUrl}${url}`,
		method: 'post',
		data: params,
		headers: {
			authorization: `Bearer `+localStorage.getItem('token')
		}
	}).then(res => {
		return res
	})
}
export const PUT = (url, params, headers) => {
	return axios({
		url: `${baseUrl}${url}`,
		method: 'put',
		data: params,
		headers: {
			authorization: `Bearer `+localStorage.getItem('token')
		}
	}).then(res => {
		return res
	})
}
export const DELETE = (url, params, headers) => {
	return axios({
		url: `${baseUrl}${url}`,
		method: 'delete',
		data: params,
		headers: {
			authorization: `Bearer `+localStorage.getItem('token')
		}
	}).then(res => {
		return res
	})
}
